package kr.co.bicycle;

import java.util.Calendar;

import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Window;

import com.nhn.android.maps.NMapActivity;


/**
 * 네이버 지도를 상속받은 맵 기본 클래스
 */
public class BaseMapActivity extends NMapActivity {

	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
        requestWindowFeature(Window.FEATURE_NO_TITLE);	// 타이틀 바 없애기
	}
	
	/**
	 * 회전이 다시 화면을 불러오는걸 방지하기위해 스크린을 잠가준다.
	 */
	public void mLockScreenRotation() {
		// Stop the screen orientation changing during an event
		switch (this.getResources().getConfiguration().orientation) {
		case Configuration.ORIENTATION_PORTRAIT:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
			break;
		case Configuration.ORIENTATION_LANDSCAPE:
			this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
			break;
		}
	}
	
	/**
	 *	화면 고정 해제
	 */
	public void unLockScreenRotation(){
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); 		
	}
	

	/**
     * 오늘 날짜 만들기
     * @return
     * 	오늘 날짜
     */
    public static String makeNow(){
    	Calendar calendar = Calendar.getInstance();
    	calendar.get(Calendar.YEAR);
     	int y = calendar.get(Calendar.YEAR);
    	int m = calendar.get(Calendar.MONDAY) +1;	// 달은 0 -11 
    	int d = calendar.get(Calendar.DAY_OF_MONTH);
    	
    	return String.format("%04d-%02d-%02d", y, m, d);
    }
    
	
}
